(function() {

var baseURL = (function() {
  var scripts = document.getElementsByTagName('script');
  for (var i=0; i<scripts.length; i++) {
    var m = scripts[i].src.match(/(.*)\/ldride-bootstrap\.js$/);
    if (m) return m[1];
  }
})();

var w = window.open('','_blank','width=1200,left=20,height=800,resizable,scrollbars=yes');
if (!w) {
  alert('please turn off popup blocker');
  return;
}

var doc = w.document;
doc.open();
doc.write([
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"',
'"http://www.w3.org/TR/html4/loose.dtd">',
'<html>',
'  <head>',
'    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />',
'    <link type="text/css" rel="stylesheet" href="',baseURL,'/ext-2.0/resources/css/ext-all.css"></link>',
'    <script type="text/javascript" src="',baseURL,'/jquery/jquery.js"></script>',
'    <script type="text/javascript" src="',baseURL,'/ext-2.0/adapter/jquery/ext-jquery-adapter.js"></script>',
'    <script type="text/javascript" src="',baseURL,'/ext-2.0/ext-all-debug.js"></script>',
'    <script type="text/javascript" src="',baseURL,'/ldride.js"></script>',
'    <script type="text/javascript">baseURL="',baseURL,'";</script>',
'  </head>',
'  <body></body>',
'</html>'
].join(''));

// doc.close()
// Ext directly writes via document.write()
setTimeout(function(){doc.close()},1000);

})()

